﻿// <copyright file="MapInfoPolygonTest.cs" company="QUT">
//     Copyright (c) Ninety Nine Percent. All rights reserved.
// </copyright>

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace Qut.GenerateKml.Data
{
    /// <summary>
    /// a class for testing MapInfopolygon class.
    /// </summary>
    [TestFixture]

    public class MapInfoPolygonTest
    {
        /// <summary>
        /// Test MapInfo polygon.
        /// </summary>
        private MapInfoPolygon mip;

        /// <summary>
        /// Test coordinates.
        /// </summary>
        private List<PointF> coords;

        /// <summary>
        /// Test point 1.
        /// </summary>
        private PointF p1;

        /// <summary>
        /// Test point 2.
        /// </summary>
        private PointF p2;

        /// <summary>
        /// Test point 3.
        /// </summary>
        private PointF p3;

        /// <summary>
        /// Initializes the all data member in the test.
        /// </summary>
        [SetUp]
        public void Initialize()
        {
            this.mip = new MapInfoPolygon();
            this.coords = new List<PointF>();
            this.p1 = new PointF();
            this.p2 = new PointF();
            this.p3 = new PointF();
        }

        /// <summary>
        /// test the getCoordinates() and addPoint functions of MapInfoPolygon
        /// </summary>
        [Test]
        public void MapInfoPolygonTest1()
        {
            this.mip.AddPoint(this.p1);
            this.coords.Add(this.p1);
            Assert.AreEqual(this.mip.GetCoordinates()[0], this.coords[0]);
        }

        /// <summary>
        /// test the getCoordinates() and addPoint functions of MapInfoPolygon
        /// </summary>
        [Test]
        public void MapInfoPolygonTest2()
        {
            this.mip.AddPoint(this.p2);
            this.mip.AddPoint(this.p3);
            Assert.AreEqual(this.mip.GetCoordinates()[0], this.p2);
            Assert.AreEqual(this.mip.GetCoordinates()[1], this.p3);
        }
    }
}